<?php

namespace app\home\validate;

use think\Validate;

class User extends Validate {
    
    /**
     * 规则定义
     * @var array
     */
    protected $rule = [
        'phone'     => 'mobile',
        'email'     => 'email',
        'phoneCode' => 'length:6',
        'emailCode' => 'length:6',
        'password'  => 'length:8,32',
    ];
    
    /**
     * 提示信息定义
     * @var array
     */
    protected $message = [
        'phone'     => '请输入11位手机号码',
        'email'     => '请输入正确的邮箱',
        'phoneCode' => '请输入6位数字手机验证码',
        'emailCode' => '请输入6位数字邮箱验证码',
        'password'  => '请输入8-32位密码',
    ];
    
    /**
     * 场景定义
     * @var array
     */
    public $scene = [
        'loginAjax' => ['password'],
        'registerAjax' => ['phone', 'email', 'phoneCode', 'emailCode', 'password'],
    ];
}